//导出学生反思作业参考分数

var Assignment

window.onload = function() { 
	var $_REQUEST = new Object, aParams = unescape(document.location.search.substr(1)).split("&");
	Assignment=JSON.parse(aParams)
	getRftAsmtReferScore(Assignment)
	};

function getRftAsmtReferScore(assignment){
	$.ajax({
		   url: "/pad/experiment/getSentenceModifiedInfo",
		   type: 'POST',
		   data:Assignment,
		   async: false,
		   dataType: "json", //返回数据格式为json
		   success: function(data) {//请求成功完成后要执行的方法
//			   console.log(data)
			   var fileTitle=data.heads;
			   var msInfo=data.modifiedSentenceInfo
//			   var fileTitle=["学号","姓名","得分","经历","情感","信念","视角","困难","自我批判","学习收获","计划"];
//			   var fileForKey=["stuNum","name","score","经历","情感","信念","视角","困难","自我批判","学习收获","计划"];
			   var str = [];
		       str.push(fileTitle.join(",")+"\n");
		       for(var i=0;i<msInfo.length;i++){
		            var temp = [];
		            for(var j=0;j<fileTitle.length;j++){
		                temp.push(msInfo[i][fileTitle[j]]);
		         }
		        str.push(temp.join(",")+"\n");
		     }
		     var uri = 'data:text/csv;charset=utf-8,\uFEFF' + encodeURIComponent(str.join(""));  
		     var downloadLink = document.createElement("a");
		     downloadLink.href = uri;
		     downloadLink.download = "句子修改信息.csv"; 
		     document.body.appendChild(downloadLink);
		     downloadLink.click();
		     document.body.removeChild(downloadLink); 
		   }
	 });
	
	$("#textId").html('下载成功！')	
}